<template>
	<text class="">{{ wen }}</text>
</template>

<script>
export default {
	props: {
		title: String
	},
	data() {
		return {
			wen: ''
		};
	},
	watch: {
		title: {
			handler(val) {
				this.setTitle(val);
			},
			deep: true,
			immediate: true
		}
	},
	methods: {
		setTitle(data) {
			var wenlen = 0;
			this.wen = ''
			this.timer = setInterval(() => {
				//取到data.content的第wenlen位
				this.wen = data.substr(0, wenlen);
				//wenlen大于data.content的长度，停止计时器
				if (wenlen < data.length) {
					wenlen++;
					this.$emit('setCopyShow', false);
				} else {
					this.$emit('setCopyShow', true);
					clearInterval(this.timer);
					// return
				}
			}, 100);
		}
	}
};
</script>

<style></style>
